-- card: 10480 from stack: in -- bmap block id: 0 -- flags: 0000 -- background id: 10181 -- name: Experiment 4 ----- HyperTalk script ----- on runExperiment global cardClear4 global trace4 global cartAccel4,dropHeight4 global timeIncrement4 put 0 into cartSpeed put 0 into timeElapsed put 200 into dropX put 300 into floorY put (floorY-dropHeight4) into dropY put the loc of button "ball" into oldPoint put 9800 into G -- Gravity in mm/s/s put false into cardClear4 choose line tool set the lineSize to 2 put "Click the mouse to stop." into field "blurb" repeat until the mouse is down put (dropX-(cartAccel4*timeElapsed*timeElapsed)/2) into x put (dropY+(G*timeElapsed*timeElapsed)/2) into y if (x < 0) or (y > 300) then exit repeat put round(x) & "," & round(y) into newPoint set the loc of button "ball" to newPoint if trace4 is true then drag from oldPoint to newPoint put newPoint into oldPoint put timeElapsed+timeIncrement4 into timeElapsed end repeat choose browse tool put "Click on this field to restore the screen." into field "blurb" show menubar end runExperiment on openCard global cardClear4,dropHeight4 if (cardClear4 is true) and (item 2 of the loc of button "ball" <> (300-dropheight4)) then put false into cardClear1 click at the loc of field "blurb" end if end openCard -- part 3 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=191 top=57 right=85 bottom=209 -- title width / last selected line: 0 -- icon id / first selected line: 16003 / 16003 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Electromagnet -- part 5 (button) -- low flags: 00 -- high flags: 0000 -- rect: left=183 top=83 right=117 bottom=217 -- title width / last selected line: 0 -- icon id / first selected line: 8499 / 8499 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Ball -- part 6 (field) -- low flags: 81 -- high flags: 2004 -- rect: left=11 top=40 right=326 bottom=403 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 0 -- font id: 3 -- text size: 12 -- style flags: 256 -- line height: 16 -- part name: Help -- part contents for background part 5 ----- text ----- Press this field to trace the path of the ball. -- part contents for card part 6 ----- text ----- This experiment is very similar to experiment #1. This experiment deals with a ball suspended from an electromagnet which is moving to the right with a constant acceleration. Thus, in the cart frame, the ball does not fall straight down. Instead, it falls in a straight diagonal line to the left. The exact angle of the line depends upon the acceleration of the electromagnet. This card simulates that experiment. It will compute and draw the path of the ball in the cart frame based on the parameters you can set by clicking on the "Set Parameters" button in the control panel. For a complete description of the experiment, click on the "Experiment Video" button in the control panel, then click on the first button in the list of selections which will appear.